// Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{namespace gitiles autoescape="contextual"}

/**
 * Common header for Gitiles.
 *
 * @param title title for this page. Always suffixed with repository name and a
 *     sitewide title.
 * @param? repositoryName repository name for this page, if applicable.
 * @param? menuEntries optional list of menu entries with "text" and optional
 *     "url" keys.
 * @param breadcrumbs navigation breadcrumbs for this page.
 * @param? css optional list of CSS URLs to include.
 * @param? js optional list of Javascript URLs to include.
 * @param? onLoad optional Javascript to execute in the body's onLoad handler.
 *     Warning: not autoescaped.
 */
{template .header}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <title>
    {$title}
    {if $repositoryName}
      {sp}- {$repositoryName}
    {/if}
    {sp}- {msg desc="name of the application"}Git at Google{/msg}
  </title>
  <link rel="stylesheet" type="text/css" href="//www.google.com/css/go.css" />

  {if $css and length($css)}
    {foreach $url in $css}
      <link rel="stylesheet" type="text/css" href="{$url}" />
    {/foreach}
  {/if}
  // Include default CSS after custom CSS so it can override defaults in third-
  // party stylesheets (e.g. prettify).
  <link rel="stylesheet" type="text/css" href="{gitiles.CSS_URL}" />

  {if $js and length($js)}
    {foreach $url in $js}
      <script src="{$url}" type="text/javascript"></script>
    {/foreach}
  {/if}
</head>
<body {if $onLoad}onload="{$onLoad|id}"{/if}>
  {call .customHeader /}

  {if $menuEntries and length($menuEntries)}
    <div class="menu">
    {foreach $entry in $menuEntries}
      {sp}
      {if $entry.url}
        <a href="{$entry.url}"{if not isLast($entry)} class="entry"{/if}>{$entry.text}</a>
      {else}
        <span{if not isLast($entry)} class="entry"{/if}>{$entry.text}</span>
      {/if}
    {/foreach}
    {sp}
    </div>
  {/if}

  {if $breadcrumbs and length($breadcrumbs)}
    <div class="breadcrumbs">
      {foreach $entry in $breadcrumbs}
        {if not isFirst($entry)}{sp}/{sp}{/if}
        {if not isLast($entry)}
          <a href="{$entry.url}">{$entry.text}</a>
        {else}
          {$entry.text}
        {/if}
      {/foreach}
    </div>
  {/if}
{/template}

/**
 * Standard footer.
 */
{template .footer}
</body>
</html>
{/template}
